package newDecoupling.dao.impl;

import cn.hutool.core.io.IoUtil;
import newDecoupling.dao.HeroDao;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Repository;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Component;

import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;

@Repository
public class HeroDaoImpl implements HeroDao {

//    @Autowired
//    private HeroDao heroDao;



    @Override
    public List<String> findAll() {
        InputStream resourceAsStream = this.getClass().getClassLoader().getResourceAsStream("hero.txt");
        ArrayList<String> lines = IoUtil.readLines(resourceAsStream, StandardCharsets.UTF_8, new ArrayList<>());
        return lines;
    }
}
